package com.famous.dagligen.iterator.right;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author zhengdalong
 * @version V1.0
 * @date 2019/8/17 4:34 PM
 */

@Slf4j
@RequiredArgsConstructor
public class ChineseIterator implements AbstractIterator<MenuItem> {
    /**
     * 游标
     */
    private int cursor = 0;

    private List<MenuItem> menuItems;

    public ChineseIterator(List<MenuItem> menuItems) {
        this.menuItems = menuItems;
    }

    @Override
    public boolean hasNext() {
        return !(cursor == menuItems.size());
    }

    @Override
    public MenuItem next() {
        MenuItem menuItem = menuItems.get(cursor);
        cursor++;
        return menuItem;
    }
}
